package com.huawei.gamebox.service.welfare.campaign.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.gamebox.service.common.cardkit.node.BaseGsNode;
import com.huawei.gamebox.service.welfare.campaign.card.BaseCampaignCard;
import o.cgu;

public abstract class BaseCampaignNode extends BaseGsNode {
    protected abstract BaseCampaignCard ˋ(boolean z);

    protected abstract int ˎ();

    public BaseCampaignNode(Context context) {
        super(context);
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        int ˏ = ˏ();
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        LayoutParams layoutParams2 = new LinearLayout.LayoutParams(ʼ(), -1);
        for (int i = 0; i < ˏ; i++) {
            if (i != 0) {
                viewGroup.addView(new Space(this.ॱ), layoutParams2);
            }
            View inflate = from.inflate(ˎ(), null);
            ˊ(ˋ(inflate));
            viewGroup.addView(inflate, layoutParams);
        }
        return true;
    }

    protected BaseCampaignCard ˋ(View view) {
        BaseCampaignCard ˋ = ˋ(false);
        ˋ.ˏ(view);
        return ˋ;
    }

    protected int ʼ() {
        return cgu.ˋ();
    }
}
